import React from 'react'
import { Cart } from '@nutui/icons-react'
<<<<<<< HEAD
import axios from 'axios'
import { Toast } from 'react-vant'

export default function ProCode(props) {
  let data = props.data
  let addCart = async () => {
    let obj = {
      name: data.name,
      price: data.price,
      buynum: 1,
      mess: data.specTitle,
      img: data.img,
      flag: true,
      uid:sessionStorage.getItem('userId')
    }
    let result = await axios.post('http://localhost:3000/zhaojunjie/cart', obj)
    if (result.data.code === 200) {
      Toast('加购成功')
    }
  }
  return (
    <div className='proCode'>
          <img src={data.img} alt=''></img>
          <div className='text'>
        <p className='title'>{data.name }</p>
            <p className='desc'>{data.desc}</p>
          </div>
      <p className='add'><span>￥{data.price }</span><><Cart onClick={addCart} style={{ backgroundColor:'rgb(88, 190, 108)',borderRadius:'50%',padding:'5px',boxSizing:'content-box'}} color='white' /></></p>  
=======
export default function ProCode(props) {
  return (
    <div className='proCode'>
          <img src={props.img} alt=''></img>
          <div className='text'>
            <p className='title'>{props.name}</p>
            <p className='desc'>{props.desc}</p>
          </div>
      <p className='add'><span>￥{props.price}</span><><Cart style={{ backgroundColor:'rgb(88, 190, 108)',borderRadius:'50%',padding:'5px',boxSizing:'content-box'}} color='white' /></></p>  
>>>>>>> origin/jiayuting
    </div>
  )
}
